﻿using System.Linq;
using NUnit.Framework;

namespace ExtensionMethodExtravaganza.Tests
{
	[TestFixture]
	public class ArrayExtensionsTests
	{
		[Test]
		public void RemovePredicateTest()
		{
			var letters = new[] { "a", "b", "c" };
			letters = letters.Remove(letter => letter == "b");

			Assert.AreEqual(2, letters.Count());
			Assert.AreEqual("a", letters[0]);
			Assert.AreEqual("c", letters[1]);
		}

		[Test]
		public void RemoveItem()
		{
			var letters = new[] { "a", "b", "c" };
			letters = letters.Remove("b");

			Assert.AreEqual(2, letters.Count());
			Assert.AreEqual("a", letters[0]);
			Assert.AreEqual("c", letters[1]);
		}

		[Test]
		public void RemoveAt()
		{
			var letters = new[] { "a", "b", "c" };
			letters = letters.RemoveAt(1);

			Assert.AreEqual(2, letters.Count());
			Assert.AreEqual("a", letters[0]);
			Assert.AreEqual("c", letters[1]);
		}
	}
}
